﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Compiler.TableOfSymbols.Types;

namespace Compiler.CompilerAPI.Contexts
{
    public class TypeSearchInfo
    {
        private BaseType typeInfo;
        private bool unknownType;
        private bool ambiguityType;

        public BaseType TypeInfo
        { get { return typeInfo; } }
        public bool UnknownType
        { get { return unknownType; } }
        public bool AmbiguityType
        { get { return ambiguityType; } }

        public TypeSearchInfo(BaseType typeInfo)
        {
            System.Diagnostics.Debug.Assert(typeInfo != null,
                String.Format("typeInfo can not be null"));
            this.typeInfo = typeInfo;
            this.unknownType = false;
            this.ambiguityType = false;
        }

        public TypeSearchInfo(bool unknownType, bool ambiguityType)
        {
            System.Diagnostics.Debug.Assert(unknownType ^ ambiguityType,
                String.Format("one of errors (unknownType ^ ambiguityType) must be true"));
            this.typeInfo = null;
            this.unknownType = unknownType;
            this.ambiguityType = ambiguityType;
        }
    }
}
